package com.idanchuang.component.businesslog.es.config;

import com.zoi7.component.core.exception.ArgumentsInvalidException;


/**
 * 索引配置
 *
 * @author yjy
 * 2020-02-21 15:54
 */
public class BusinessLogConfig {

    /** 实体所在包 */
    private String documentPackage;
    /** scroll查询滚动窗口大小, 默认: 1000 */
    private int scrollSize = 1000;
    /** scroll查询超时时间, 单位: 秒, 默认: 30 */
    private int scrollTimeout = 30;
    /** 对应于es索引的配置(index.max_result_window), 默认: 10000 */
    private int maxResultWindow = 10000;
    /** 深度分页查询时滚动窗口大小, 默认: 5000, 最大值不能超过 maxResultWindow */
    private int searchAfterSize = 5000;
    /** 启动索引生命周期配置开关，true使用xpack， false 使用 open distro*/
    private boolean indexPolicy = true;

    public String getDocumentPackage() {
        return documentPackage;
    }

    public void setDocumentPackage(String documentPackage) {
        this.documentPackage = documentPackage;
    }

    public int getScrollSize() {
        return scrollSize;
    }

    public void setScrollSize(int scrollSize) {
        if (scrollSize < 1) {
            throw new ArgumentsInvalidException("scrollSize: [" + scrollSize + "] can not be < 1");
        }
        this.scrollSize = scrollSize;
    }

    public int getScrollTimeout() {
        return scrollTimeout;
    }

    public void setScrollTimeout(int scrollTimeout) {
        this.scrollTimeout = scrollTimeout;
    }

    public int getSearchAfterSize() {
        return searchAfterSize;
    }

    public int getMaxResultWindow() {
        return maxResultWindow;
    }

    public void setMaxResultWindow(int maxResultWindow) {
        this.maxResultWindow = maxResultWindow;
    }

    public void setSearchAfterSize(int searchAfterSize) {
        this.searchAfterSize = searchAfterSize;
    }

    public boolean isIndexPolicy() {
        return indexPolicy;
    }

    public void setIndexPolicy(boolean indexPolicy) {
        this.indexPolicy = indexPolicy;
    }
}
